<div id="main-content">
  <div class="container-fluid">
    <div class="row-fluid">
      <div class="span12">
        <div class="widget-block">
          <?php
          if($message == 'filed'){
          ?>
          <div class="alert alert-error fade in">
            <button data-dismiss="alert" class="close" type="button">×</button>
            <strong>Filed!</strong> Fail to save data.
          </div>
          <?php
          }
          if($message == 'sukses'){
          ?>
          <div class="alert alert-success fade in">
            <button data-dismiss="alert" class="close" type="button">×</button>
            <strong>Success!</strong> Now you have new user.
          </div>
          <?php
          }
          ?>
          <div class="widget-head">
            <h5><?=$title_table?></h5>
            <div class="widget-control pull-right">
              <a href="#" data-toggle="dropdown" class="btn dropdown-toggle"><i class="icon-cog"></i><b class="caret"></b></a>
              <ul class="dropdown-menu">
                <!--<li><a href="<?=  site_url("outlet/add-new") ?>"><i class="icon-plus"></i> Add New</a></li>-->
<!--                <li><a href="#"><i class="icon-ok"></i> Active</a></li>
                <li><a href="#"><i class="icon-minus-sign"></i> No-Active</a></li>
                <li><a href="#"><i class="black-icons pdf_document"></i> Export to PDF</a></li>-->
                <li><a href="<?=  site_url("outlet/export-master-outlet") ?>"><i class="black-icons excel_document"></i> Export to XLS</a></li>
              </ul>
            </div>
          </div>
          <div class="widget-content">
            <div class="widget-box">
              <table class="data-tbl-boxy table">
                <thead>
                  <tr>
                    <th>Outlet</th>
                    <th>Kepala</th>
                    <th>Pass</th>
                    <th>Owner</th>
                    <th>Pass</th>
                  </tr>
                </thead>
                <tbody>
                  <?php
                  if(is_array($data)){
                    foreach ($data as $key => $value) {
                      $head_name = "<td>";
                      $head_link = "<td>";
                      foreach($value->kepala as $km => $head){
                        $head_name .= "{$head->name}<br />";
                        $link_kepala = site_url("users/generate_password_no_mail/".$head->id_users);
                        $head_link .= "<a href={$link_kepala}>{$this->encrypt->decode($head->pass)}</a><br />";
                      }
                      $head_name .= "</td>";
                      $head_link .= "</td>";
                      
                      $own_name = "<td>";
                      $own_link = "<td>";
                      foreach($value->owner as $km => $own){
                        $own_name .= "{$own->name}<br />";
                        $link_owner = site_url("users/generate_password_no_mail/".$own->id_users);
                        $own_link .= "<a href={$link_owner}>{$this->encrypt->decode($own->pass)}</a><br />";
                      }
                      $own_name .= "</td>";
                      $own_link .= "</td>";
                      
                      print <<<EOD
                  <tr>
                    <td>{$value->name}</td>
                    {$head_name}
                    {$head_link}
                    {$own_name}
                    {$own_link}
                  </tr>
EOD;
                    }
                  }
                  ?>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>